package org.weasel.unittests;

import junit.framework.TestCase;

import org.weasel.business.Company;
import org.weasel.business.Developer;
import org.weasel.business.Project;
import org.weasel.business.Unscheduled;

public class CompanyTest extends TestCase {

	private Company company;
	
	protected void setUp() throws Exception {
		super.setUp();
		company = new Company("cName", null, null);
	}

	protected void tearDown() throws Exception {
		super.tearDown();
		company = null;
	}

	public void testAddProject() {
		Project p = new Project("pID", "pname", null, null, new Unscheduled("uID", null), "", "15.05.2007", 6);
		company.addProject(p);
		Project pCheck = company.getProject(p.getId());
		assertEquals(p.getId(), pCheck.getId());
	}

	public void testRemoveProject() {
		Project p = new Project("pID", "pname", null, null, new Unscheduled("uID", null), "", "15.05.2007", 6);
		company.addProject(p);
		company.removeProject(p.getId());
		assertNull(company.getProject(p.getId()));
	}

	public void testAddGetDeveloper() {
		Developer d = new Developer("HInnerhofer", "Hannes", "Stift", "keine@gmx.net");
		company.addDeveloper(d);
		Developer dCheck = company.getDeveloper(d.getId());
		assertEquals(d.getId(), dCheck.getId());
	}

	public void testRemoveDeveloper() {
		Developer d = new Developer("HInnerhofer", "Hannes", "Stift", "keine@gmx.net");
		company.addDeveloper(d);
		company.removeDeveloper(d.getId());
		assertNull(company.getDeveloper(d.getId()));
	}

}
